package com.alec.demo1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

//默认扫描当前包及其子包
//@SpringBootApplication(scanBasePackages="com.alec.demo1")
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan("com.alec.demo1")
public class Demo1Application {

    public static void main(String[] args) {
        //返回IOC容器
        ConfigurableApplicationContext run=SpringApplication.run(Demo1Application.class, args);
        //查看容器中的组件
        String[] names=run.getBeanDefinitionNames();
        for (String name:names){
            System.out.println(name);
        }
    }

}
